#pragma once
#include <iostream>
#include <string>
#include <functional>
#include <string>
class Task
{
    typedef std::function<void(int, const std::string &, const uint16_t &)> func_t;
public:
    Task() = default;
    Task(func_t callback, int sockfd, const std::string &ip, const uint16_t &port)
        :callback_(callback), sockfd_(sockfd), ip_(ip), port_(port)
    {}
    ~Task()
    {
    }
    void operator()()
    {
        callback_(sockfd_, ip_, port_);
    }
private:
    func_t callback_;
    int sockfd_;
    std::string ip_;
    std::uint16_t port_;
};